package com.ftg.learn.controller;

import com.ftg.learn.entity.Student;
import com.ftg.learn.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author kangjx
 * @createTime 2022/9/13
 */
@RestController
@RefreshScope
public class StudentController {

    @Autowired
    StudentService studentService;

    @Value("${spring.datasource.username}")
    String username;

    @GetMapping("/showall")
    public List<Student> showList(){
        System.out.println("username==>" + username);
        return studentService.list();
    }

}
